﻿@model Cdf54.Ja.SignalR.Chat.Models.RegisterViewModel
@{
    ViewBag.Title = "Register";
}

<h2>@ViewBag.Title.</h2>
@*/* Add extension enctype = "multipart/form-data"*/*@
@using (Html.BeginForm("Register", "Account", FormMethod.Post, new { @class = "form-horizontal", role = "form", enctype = "multipart/form-data" }))
{
    @Html.AntiForgeryToken()
    <h4>Create a new account.</h4>
    <hr />
    @Html.ValidationSummary("", new { @class = "text-danger" })
    <div class="form-group">
        @Html.LabelFor(m => m.Pseudo, new { @class = "col-md-2 control-label" })
        <div class="col-md-10">
            @Html.TextBoxFor(m => m.Pseudo, new { @class = "form-control" })
        </div>
    </div>
    <div class="form-group">
        @Html.LabelFor(m => m.Email, new { @class = "col-md-2 control-label" })
        <div class="col-md-10">
            @Html.TextBoxFor(m => m.Email, new { @class = "form-control" })
        </div>
    </div>
    <div class="form-group">
        @Html.LabelFor(m => m.Password, new { @class = "col-md-2 control-label" })
        <div class="col-md-10">
            @Html.PasswordFor(m => m.Password, new { @class = "form-control" })
        </div>
    </div>
    <div class="form-group">
        @Html.LabelFor(m => m.ConfirmPassword, new { @class = "col-md-2 control-label" })
        <div class="col-md-10">
            @Html.PasswordFor(m => m.ConfirmPassword, new { @class = "form-control" })
        </div>
    </div>
    /* Add extension */
    <div class="form-group">
        @Html.Label("Actual photo", new { @class = "col-md-2 control-label" })
        <div class="col-md-10">
            <img src="@Html.DisplayFor(m => m.PhotoUrl)" alt="@Model.Pseudo" width="100" title="@Model.Pseudo" />
            <span id="preview" hidden><kbd>Preview >> </kbd><img id="blah" src="#" alt="" width="100" /></span>
            <h6><small>@Html.DisplayFor(m => m.PhotoUrl)</small></h6>

        </div>
    </div>
    <div class="form-group">
        @Html.LabelFor(m => m.Photo, new { @class = "col-md-2 control-label" })
        <div class="col-md-10">
            @*@Html.TextBoxFor(m => m.Photo, null, new { id = "filePhoto", onchange = "readURL(this)", type = "file", title = "Search for file to add", @class = "btn btn-default" })*@
            @*Real Bootstrap input !*@
            <input id="filePhoto" onchange="readURL(this)" type="file" name="Photo" style="visibility:hidden;">
            <div class="input-group">
                <input id="subfile" type="text" class="form-control" placeholder="Search for image file to add..." readonly>
                <span class="input-group-btn">
                    <a id="submitbutton" class="btn btn-primary" onclick="$('#filePhoto').click();">Browse</a>
                </span>
            </div>
            @Html.ValidationMessageFor(m => m.Photo)<br />

        </div>
    </div>
    <div class="form-group">
        @Html.LabelFor(model => model.UseGravatar, new { @class = "col-md-2 control-label" })
        <div class="col-md-10">
            @*Obsolete*@
            @*@Html.CheckBoxFor(model => model.UseGravatar, new { @onclick = "UseGravatarClick('" + @Model.Email + "',100" + ")" })*@

            @Html.CheckBoxFor(model => model.UseGravatar, new Dictionary<string, object>
                {
                    {"id", "UseGravatar"},
                    { "data-email", @Model.Email },
                    { "data-size", "100" },
                })
            <small class="text-muted"> See <a title="My gravatar" href="https://fr.gravatar.com/" target="_blank">Gravatar Web Site</a></small>
        </div>
    </div>
    /* \Add extension */
    <div class="form-group">
        <div class="col-md-offset-2 col-md-10">
            <input type="submit" class="btn btn-default" value="Register" />
        </div>
    </div>


}

@section Scripts {
    @Scripts.Render("~/bundles/jqueryval")
    @Scripts.Render("~/bundles/chatphoto")
}